<?php
	include_once "db_connect.php";

	//====================================================
	// 후기 리스트 가져오기
	//====================================================
	
	// 스타 오늘의 운세는 리스트 갯수가 다름.
	if ($_SERVER['REQUEST_URI'] == '/unse/star/todaybirth/main') {
		$page_size = 3;
	} else {
		$page_size = 4;
	}
	
	// 쿼리문 작성
	$sql  = " SELECT ";
	$sql .= "       B.idx ";
	$sql .= "     , B.category ";
	$sql .= "     , B.user_id ";
	$sql .= "     , B.nickname ";
	$sql .= "     , B.service_id ";
	$sql .= "     , S.service_url ";
	$sql .= "     , S.service_name ";
	$sql .= "     , (SELECT service_group_name FROM tb_service_group WHERE service_group_id = S.service_group_id) service_group_name ";
	$sql .= "     , B.subject ";
	$sql .= "     , B.content ";
	$sql .= " FROM  tb_bbs B ";
	$sql .= " JOIN  tb_service S ON B.service_id = S.service_id ";
	$sql .= " WHERE 1=1 ";
	$sql .= " AND   category = 'postscript' ";
	$sql .= " AND   B.notice_yn = 'N' ";
	$sql .= " ORDER BY B.create_dt DESC ";
	$sql .= " LIMIT 1, $page_size ";
	
	$result_list = query_to_array($sql);
	
	// 썸네일 이미지 파일명
	$ps_thumb = array(
		  'star_todaybirth' => 'sum_star_86.jpg'
		, 'star_gunghap'    => 'sum_star_86.jpg'
		, 'money_mymoney'   => 'sum_money_86.jpg'
		, 'money_gunghap'   => 'sum_money_86.jpg'
		, 'saju_total'      => 'sum_saju_86.jpg'
		, 'tojung_total'    => 'sum_tog_86.jpg'
		, 'gunghap_mylover' => 'sum_gh_86.jpg'
		, 'gunghap_sintong' => 'sum_gh_86.jpg'
		, 'gunghap_style'   => 'sum_gh_86.jpg'
		, 'adult_total'     => 'sum_sex_86.jpg'
		, 'free_today'      => 'sum_today_86.jpg'
	);
?>
				<div class="board">
					<div class="tit">
						<h3><img src="/images/main/tit_notice.gif" /></h3>
						<span class="more"><a href="/cs/notice">더보기</a></span>
					</div>
					<ul>
<?	foreach ($result_list as $item) { ?>
						<li><a href="/bbs/<?=$item['category']?>/read?idx=<?=$item['idx']?>"><em>[<?=$item['cate_name']?>]</em> <?=mb_substr($item['subject'],0,18-mb_strlen($item['cate_name'],'utf-8'),'utf-8')?> </a></li>
<?	} ?>
					</ul>
					<p><img src="/images/sub/common/sub_cs.gif" alt="02)3219-8253" /></p>
					<ul class="nlink">
						<li><a href="/bbs/qna/write">1:1 친절상담</a></li>
						<li class="cs"><a href="/bbs/faq">자주하는 질문</a></li>
					</ul>
				</div>